<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>offset的bug</title>
   <style>
    #div1{width:200px;height:200px;background:red;border:1px solid black;}
   </style>
   <script>
   //获取元素的内部样式
   function getStyle(obj,name){
     if(obj.currentStyle){
	    return obj.currentStyle[name];
	 }else{
	    return getComputedStyle(obj,false)[name];
	 }
   }
    setInterval(function(){
	    var oDiv=document.getElementById("div1");
		oDiv.style.width=oDiv.offsetWidth-1+"px";
		//oDiv.style.width=parseInt(getStyle(oDiv,'width'))-1+'px';		
	},30);
   </script>
</head>
<body>
  <div id="div1"></div>


</body>
</html>